import React from 'react';
import { WeaTop } from 'ecCom';
import ListView from '../comp/view-list';
import { observer } from 'mobx-react';
import { Spin } from "antd";

@observer
export default class ItemList extends React.Component{
    render() {
        const { title, store, fromPortal } = this.props;
        if(fromPortal){
            return (
                <Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@evnx5m`} spinning={store.prjListloading} >
                    <ListView ecId={`${this && this.props && this.props.ecId || ''}_ListView@yi412o`}
                        datas={store.prjList}
                        onItemClick={store.changeSelectedKey}
                        pagination={{
                            current:store.pagination.current,
                            pageSize:store.pagination.pageSize,
                            total:store.pagination.total,
                            onChange:store.onChangePaginNation
                        }}
                        currentKey={store.currentKey}
                        scrollHeight={store.commonStore.contentHeight - 171}
                        onSearchListItem={store.onSearchListItem}
                        onSearchChange={store.onSearchChange}
                        prjValue={store.prjValue}
                        fromPortal={fromPortal}
                    />
                </Spin>
            )
        }
        return (
            <WeaTop ecId={`${this && this.props && this.props.ecId || ''}_WeaTop@381fpb`}
                title={title}
                icon={<i className='icon-coms-project' />}
                iconBgcolor='#217346'
            >
                <Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@togxob`} spinning={store.prjListloading} >
                    <ListView ecId={`${this && this.props && this.props.ecId || ''}_ListView@rv11da`}
                        datas={store.prjList}
                        onItemClick={store.changeSelectedKey}
                        pagination={{
                            current:store.pagination.current,
                            pageSize:store.pagination.pageSize,
                            total:store.pagination.total,
                            onChange:store.onChangePaginNation
                        }}
                        currentKey={store.currentKey}
                        scrollHeight={store.commonStore.contentHeight - 120}
                        onSearchListItem={store.onSearchListItem}
                        onSearchChange={store.onSearchChange}
                        prjValue={store.prjValue}
                    />
                </Spin>
            </WeaTop>
        )
    }
}